package com.sleepcamel.resteasyConfigurator.view.detail;

import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.graphics.Image;

import com.sleepcamel.rest.domain.ISourceCodeGenerable;
import com.sleepcamel.rest.domain.method.parameter.MethodParameter;
import com.sleepcamel.rest.domain.sourcegenerator.ISourceCodeGenerator;
import com.sleepcamel.rest.domain.sourcegenerator.SourceCodeGeneratorProvider;

public class MethodParameterLabelProvider implements ILabelProvider {

	@Override
	public void addListener(ILabelProviderListener paramILabelProviderListener) {
	}

	@Override
	public void dispose() {
	}

	@Override
	public boolean isLabelProperty(Object paramObject, String paramString) {
		return false;
	}

	@Override
	public void removeListener(ILabelProviderListener paramILabelProviderListener) {
	}

	@Override
	public Image getImage(Object paramObject) {
		return null;
	}

	@Override
	public String getText(Object paramObject) {
		StringBuilder sb = new StringBuilder();
		if ( paramObject instanceof MethodParameter){
			ISourceCodeGenerator sourceCodeGenerator = SourceCodeGeneratorProvider.getInstance().getGeneratorFor(paramObject);
			sourceCodeGenerator.setData((ISourceCodeGenerable) paramObject);
			sb.append(sourceCodeGenerator.generateInterfaceSource());
		}
		return sb.toString();
	}

}
